home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / kerberos / pc / krb_libk.lha / Lib / KRB / CR_DEATH.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-30  |  1.6 KB  |  66 lines

  1. /*
  2.  * $Source: /mit/kerberos/src/lib/krb/RCS/create_death_packet.c,v $
  3.  * $Author: rfrench $
  4.  *
  5.  * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
  6.  * of Technology.
  7.  *
  8.  * For copying and distribution information, please see the file
  9.  * <mit-copyright.h>.
  10.  */
  11.  
  12. #ifndef lint
  13. static char *rcsid_cr_death_packet_c =
  14. "$Header: create_death_packet.c,v 4.9 89/01/17 16:05:59 rfrench Exp $";
  15. #endif /* lint */
  16.  
  17. #include <mit_copy.h>
  18. #include <krb.h>
  19. #include <prot.h>
  20. #include <string.h>
  21.  
  22. /*
  23.  * This routine creates a packet to type AUTH_MSG_DIE which is sent to
  24.  * the Kerberos server to make it shut down.  It is used only in the
  25.  * development environment.
  26.  *
  27.  * It takes a string "a_name" which is sent in the packet.  A pointer
  28.  * to the packet is returned.
  29.  *
  30.  * The format of the killer packet is:
  31.  *
  32.  * type            variable        data
  33.  *            or constant
  34.  * ----            -----------        ----
  35.  *
  36.  * unsigned char    KRB_PROT_VERSION    protocol version number
  37.  * 
  38.  * unsigned char    AUTH_MSG_DIE        message type
  39.  * 
  40.  * [least significant    HOST_BYTE_ORDER        byte order of sender
  41.  *  bit of above field]
  42.  * 
  43.  * string        a_name            presumably, name of
  44.  *                         principal sending killer
  45.  *                         packet
  46.  */
  47.  
  48. #ifdef DEBUG
  49. KTEXT
  50. krb_create_death_packet(a_name)
  51.     char *a_name;
  52. {
  53.     static KTEXT_ST pkt_st;
  54.     KTEXT pkt = &pkt_st;
  55.  
  56.     unsigned char *v =  pkt->dat;
  57.     unsigned char *t =  (pkt->dat+1);
  58.     *v = (unsigned char) KRB_PROT_VERSION;
  59.     *t = (unsigned char) AUTH_MSG_DIE;
  60.     *t |= HOST_BYTE_ORDER;
  61.     (void) strcpy((char *) (pkt->dat+2),a_name);
  62.     pkt->length = 3 + strlen(a_name);
  63.     return pkt;
  64. }
  65. #endif /* DEBUG */
  66.